package com.guoguo.cloudmusic.ui.playList

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel
import com.guoguo.cloudmusic.logic.Repository
import com.guoguo.cloudmusic.logic.model.SongList

class PlayListVewModel : ViewModel() {
    private val songsId = MutableLiveData<String>()
    val playSongList = ArrayList<SongList.Song>()

    //拿到从仓库层返的liveData
    val playSongListLiveData = Transformations.switchMap(songsId) {
        Repository.getPlayListDetail(it)
    }

    fun getPlayListTrack(data: String) {
        songsId.value = data
    }
}